package com.legend.security;

/**
 * User: ChuanQi
 * Date: 13-6-3
 * Time: 下午11:01
 * 权限操作的类别
 */
public enum PermissionType {

    None("无", 0),
    Add("添加", 2), Delete("删除", 4), Edit("修改", 8), View("查看", 16),
    Sort("排序", 32), On("启用", 64), Off("禁用", 128), List("列表", 256),
    PhysicalDel("物理删除", 512), Define1024("自定义1024", 1024), Define2048("自定义2048", 2048),
    Define4096("自定义4096", 4096), Define8192("自定义8192", 8192), Define16384("自定义", 16384),
    Define32768("自定义", 32768), Define65536("自定义", 65536), Define131072("自定义", 131072),
    Define262144("自定义", 262144), Define524288("自定义", 524288), Define1048576("自定义", 1048576);
    private String description;
    private int value;
    public int getValue() {
        return value;
    }
    public void setValue(int value) {
        this.value = value;
    }
    public String getDescription() {
        for (PermissionType c : PermissionType.values()) {
            if (c.getValue() == value) {
                return c.description;
            }
        }
        return null;
    }
    public void setDescription(String name) {
        this.description = name;
    }
    private PermissionType(String description, int value) {
        this.description = description;
        this.value = value;
    }
}
